/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Bari
 */
@Entity
@Table(name = "reservation_logs")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ReservationLogs.findAll", query = "SELECT r FROM ReservationLogs r"),
    @NamedQuery(name = "ReservationLogs.findById", query = "SELECT r FROM ReservationLogs r WHERE r.id = :id"),
    @NamedQuery(name = "ReservationLogs.findByReservationtime", query = "SELECT r FROM ReservationLogs r WHERE r.reservationtime = :reservationtime"),
    @NamedQuery(name = "ReservationLogs.findByReservationend", query = "SELECT r FROM ReservationLogs r WHERE r.reservationend = :reservationend"),
    @NamedQuery(name = "ReservationLogs.findByEvent", query = "SELECT r FROM ReservationLogs r WHERE r.event = :event")})
public class ReservationLogs implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Column(name = "reservationtime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date reservationtime;
    @Column(name = "reservationend")
    @Temporal(TemporalType.TIMESTAMP)
    private Date reservationend;
    @Size(max = 45)
    @Column(name = "event")
    private String event;
    @JoinColumn(name = "uid", referencedColumnName = "id")
    @ManyToOne
    private User uid;
    @JoinColumn(name = "rid", referencedColumnName = "id")
    @ManyToOne
    private Resource rid;

    public ReservationLogs() {
    }

    public ReservationLogs(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getReservationtime() {
        return reservationtime;
    }

    public void setReservationtime(Date reservationtime) {
        this.reservationtime = reservationtime;
    }

    public Date getReservationend() {
        return reservationend;
    }

    public void setReservationend(Date reservationend) {
        this.reservationend = reservationend;
    }

    public String getEvent() {
        return event;
    }

    public void setEvent(String event) {
        this.event = event;
    }

    public User getUid() {
        return uid;
    }

    public void setUid(User uid) {
        this.uid = uid;
    }

    public Resource getRid() {
        return rid;
    }

    public void setRid(Resource rid) {
        this.rid = rid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReservationLogs)) {
            return false;
        }
        ReservationLogs other = (ReservationLogs) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.ReservationLogs[ id=" + id + " ]";
    }
    
}
